package com.ruoyi.rural.service.impl;

import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.rural.domain.RuralApplicationPovertyAlleviationMaterials;
import com.ruoyi.rural.mapper.RuralApplicationPovertyAlleviationMaterialsMapper;
import com.ruoyi.rural.service.IRuralApplicationPovertyAlleviationMaterialsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

/**
 * 扶贫物资申领Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-02-26
 */
@Service
public class RuralApplicationPovertyAlleviationMaterialsServiceImpl implements IRuralApplicationPovertyAlleviationMaterialsService 
{
    @Autowired
    private RuralApplicationPovertyAlleviationMaterialsMapper ruralApplicationPovertyAlleviationMaterialsMapper;

    /**
     * 查询扶贫物资申领
     * 
     * @param id 扶贫物资申领主键
     * @return 扶贫物资申领
     */
    @Override
    public RuralApplicationPovertyAlleviationMaterials selectRuralApplicationPovertyAlleviationMaterialsById(String id)
    {
        return ruralApplicationPovertyAlleviationMaterialsMapper.selectRuralApplicationPovertyAlleviationMaterialsById(id);
    }

    /**
     * 查询扶贫物资申领列表
     * 
     * @param ruralApplicationPovertyAlleviationMaterials 扶贫物资申领
     * @return 扶贫物资申领
     */
    @Override
    public List<RuralApplicationPovertyAlleviationMaterials> selectRuralApplicationPovertyAlleviationMaterialsList(RuralApplicationPovertyAlleviationMaterials ruralApplicationPovertyAlleviationMaterials)
    {
        return ruralApplicationPovertyAlleviationMaterialsMapper.selectRuralApplicationPovertyAlleviationMaterialsList(ruralApplicationPovertyAlleviationMaterials);
    }

    /**
     * 新增扶贫物资申领
     * 
     * @param ruralApplicationPovertyAlleviationMaterials 扶贫物资申领
     * @return 结果
     */
    @Override
    public int insertRuralApplicationPovertyAlleviationMaterials(RuralApplicationPovertyAlleviationMaterials ruralApplicationPovertyAlleviationMaterials)
    {
        ruralApplicationPovertyAlleviationMaterials.setId(UUID.randomUUID().toString());
        ruralApplicationPovertyAlleviationMaterials.setCreateTime(DateUtils.getNowDate());
        return ruralApplicationPovertyAlleviationMaterialsMapper.insertRuralApplicationPovertyAlleviationMaterials(ruralApplicationPovertyAlleviationMaterials);
    }

    /**
     * 修改扶贫物资申领
     * 
     * @param ruralApplicationPovertyAlleviationMaterials 扶贫物资申领
     * @return 结果
     */
    @Override
    public int updateRuralApplicationPovertyAlleviationMaterials(RuralApplicationPovertyAlleviationMaterials ruralApplicationPovertyAlleviationMaterials)
    {
        ruralApplicationPovertyAlleviationMaterials.setUpdateTime(DateUtils.getNowDate());
        return ruralApplicationPovertyAlleviationMaterialsMapper.updateRuralApplicationPovertyAlleviationMaterials(ruralApplicationPovertyAlleviationMaterials);
    }

    /**
     * 批量删除扶贫物资申领
     * 
     * @param ids 需要删除的扶贫物资申领主键
     * @return 结果
     */
    @Override
    public int deleteRuralApplicationPovertyAlleviationMaterialsByIds(String[] ids)
    {
        return ruralApplicationPovertyAlleviationMaterialsMapper.deleteRuralApplicationPovertyAlleviationMaterialsByIds(ids);
    }

    /**
     * 删除扶贫物资申领信息
     * 
     * @param id 扶贫物资申领主键
     * @return 结果
     */
    @Override
    public int deleteRuralApplicationPovertyAlleviationMaterialsById(String id)
    {
        return ruralApplicationPovertyAlleviationMaterialsMapper.deleteRuralApplicationPovertyAlleviationMaterialsById(id);
    }

    @Override
    public List<RuralApplicationPovertyAlleviationMaterials> selectRuralApplicationPovertyAlleviationMaterialsListByWeek(RuralApplicationPovertyAlleviationMaterials ruralApplicationPovertyAlleviationMaterials) {
        return ruralApplicationPovertyAlleviationMaterialsMapper.selectRuralApplicationPovertyAlleviationMaterialsListByWeek(ruralApplicationPovertyAlleviationMaterials);
    }
}
